﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Data.SqlClient;
using quanlynhasach.Linksql;
namespace quanlynhasach
{
    public partial class frmLogin : Form
    {
        Nhanviensql nv = new Nhanviensql();
        public frmLogin()
        {
            int a;
            InitializeComponent();
            AcceptButton = BtnLogin;
            CancelButton = BtnThoat;
        }

        private void btnLogin_Click(object sender, EventArgs e)
        {
            if (nv.login(txtUser.Text, txtPass.Text) != "")
            {
                frmMain.quyen = nv.quyen(txtUser.Text);
                frmMain.user = txtUser.Text;
                frmMain _frmMain = new frmMain();
                _frmMain.Show();
                Hide();
            }
            else
                MessageBox.Show("Sai Tên Đăng Nhập Hoặc Mật Khẩu!", "ĐĂNG NHẬP", MessageBoxButtons.OK);
        }

        private void btnThoat_Click(object sender, EventArgs e)
        {
            Application.Exit();
        }

        private void frmLogin_FormClosed(object sender, FormClosedEventArgs e)
        {
            Application.Exit();
        }

        private void frmLogin_Load(object sender, EventArgs e)
        {

        }
    }
}
